// src/router/index.js
import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router';
import MainLayout from '../views/MainLayout.vue'; // 导入主布局组件
import CheckItemManagement from '../views/CheckItemManagement.vue';
import CheckGroupManagement from '../views/CheckGroupManagement.vue';
import OrderSettingManagement from '../views/OrderSettingManagement.vue';
import SetmealManagement from '../views/SetmealManagement.vue';
import MemberArchives from "@/views/MemberArchives.vue";
import PhysicalExaminationAppointment from "@/views/PhysicalExaminationAppointment.vue";
import PersonalManagement from "@/views/PersonalManagement.vue";
import HealthManagement from "@/views/HealthManagement.vue";
import Dashboard from "@/views/Dashboard.vue";


const router = createRouter({
    history: createWebHashHistory(),
    routes:[
        {
            path: '/',
            name: 'Home',
            component: MainLayout, // 将 MainLayout 作为根路径的组件
            redirect: '/index', // 默认重定向到检查项管理页面
            children: [
                // 嵌套在 MainLayout 中的子路由
                {
                    path: '/checkitem',
                    name: 'CheckItemManagement',
                    component: CheckItemManagement,
                    meta: { requiresAuth: true, title: '检查项管理' }
                },
                {
                    path: '/checkgroup',
                    name: 'CheckGroupManagement',
                    component: CheckGroupManagement,
                    meta: { requiresAuth: true, title: '检查组管理' }
                },
                {
                    path: '/ordersetting',
                    name: 'OrderSettingManagement',
                    component: OrderSettingManagement,
                    meta: { requiresAuth: true, title: '预约设置' }
                },
                {
                    path: '/setmeal',
                    name: 'SetmealManagement',
                    component: SetmealManagement,
                    meta: { requiresAuth: true, title: '套餐管理' }
                },
                // ... 根据您的侧边栏结构添加其他路由（例如，/2-1，/4-1 等）
                // 以下是根据您 main.html 中菜单项的占位符路由示例
                {
                    path: '/2-1',
                    name: 'MemberManagement', // 占位符名称
                    component: MemberArchives, // 占位符组件
                    meta: { requiresAuth: true, title: '会员管理' }
                },
                {
                    path: '/2-2',
                    name: 'PhysicalExaminationAppointment',
                    component: PhysicalExaminationAppointment,
                    meta: { requiresAuth: true, title: '体检预约' }
                },
                {
                    path: '/2-3',
                    name: 'PersonalManage',
                    component: PersonalManagement,
                    meta: { requiresAuth: true, title: '人员管理' }
                },
                {
                    path: '/2-4',
                    name: 'HealthManagement',
                    component: HealthManagement,
                    meta: { requiresAuth: true, title: '健康管理' }
                },
                {
                    path: '/4-1',
                    name: 'TCMIdentity', // 占位符名称
                    component: { template: '<div>中医体质辨识页面</div>' }, // 占位符组件
                    meta: { requiresAuth: true, title: '中医体质辨识' }
                },
                {
                    path: '/index',
                    name: 'index', // 占位符名称
                    component: Dashboard,
                    meta: { requiresAuth: true, title: '主页' }
                },
                {
                    path: '/5-1',
                    name: 'WorkloadStatistics', // 占位符名称
                    component: { template: '<div>工作量统计页面</div>' }, // 占位符组件
                    meta: { requiresAuth: true, title: '工作量统计' }
                },
            ]
        },
    ]
});


export default router;